package com.seecen.webproject.utils;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
import java.util.regex.Pattern;

public class MyUtils {

    public static Properties getProperties(InputStream is) {
        Properties properties = new Properties();
        try {
            properties.load(is);
        } catch (IOException e) {
            e.printStackTrace();
        }
        return properties;
    }

    public static String humpConvertHungary(String str) {
        Pattern p = Pattern.compile("[A-Z]");
        int i = 1;
        for (; i < str.length(); i++) {
            if(p.matcher(str.charAt(i) + "").matches()) {
                break;
            }
        }
        if(i == str.length()) return str;
        return new StringBuilder(str).insert(i, "_").toString().toUpperCase();
    }


    public static boolean isEmpty(String str) {
        return str == null || "".equals(str.trim());
    }
}
